package com.student.manager.dao;

import com.student.manager.bean.Student;

import java.sql.SQLException;
import java.util.List;

public interface StudentDao {

    /**
     * 每页查询的量
     */
    int PAGE_SIZE = 5;

    /**
     * 查询当页的学生数据
     * @param currentPage
     * @return
     * @throws SQLException
     */
    List<Student> findStudentByPage(int currentPage) throws SQLException;

    /**
     * 查询所有学生
     * @return
     * @throws SQLException
     */
    List<Student> findAllStudents() throws SQLException;

    /**
     * 更具ID查询单个学生对象
     * @param sid
     * @return
     * @throws SQLException
     */
    Student findStudentById(int sid) throws SQLException;

    /**
     * 模糊查询学生
     * @param sname
     * @param sgender
     * @return
     * @throws SQLException
     */
    List<Student> likeSearchStudent(String sname, String sgender) throws SQLException;

    /**
     * 插入学生
     * @param student
     * @throws SQLException
     */
    void insert(Student student) throws SQLException;

    /**
     * 根据ID删除学生
     * @param sid
     * @throws SQLException
     */
    void delete(int sid) throws SQLException;

    /**
     * 更新学生数据
     * @param student
     * @throws SQLException
     */
    void update(Student student) throws SQLException;

    /**
     * 查询学生记录的条数
     * @return
     * @throws SQLException
     */
    int findCount() throws SQLException;

}
